package com.twinkle.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.twinkle.dao.MetadataColumnMapper;
import com.twinkle.model.MetadataColumnEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @title: MetadataColumnServiceImpl
 * @description:
 * @author: Paul
 * @date: 2023/3/14 11:26
 */
@Service
public class MetadataColumnServiceImpl {

    @Autowired
    MetadataColumnMapper metadataColumnMapper;

    public List<String> getTableList(int sourceId) {
        return metadataColumnMapper.getAllTableBySourceId(sourceId);
    }

    public List<MetadataColumnEntity> getTableColumns(int sourceId, String tableId) {
        return metadataColumnMapper.selectList(new QueryWrapper<MetadataColumnEntity>()
                .eq("source_id", sourceId)
                .eq("table_id", tableId));
    }

}
